package com.jbit.service.impl;

import com.jbit.pojo.Menu;
import com.jbit.mapper.MenuMapper;
import com.jbit.service.MenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jbit.utils.MenuTreeBuilderUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 菜单表 服务实现类
 * </p>
 *
 * @author LiRenZhi
 * @since 2021-08-25
 */
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {

    /**
     * 获取菜单树
     * @return
     */
    @Override
    public List<Menu> getAllMenuTree() {
        String username = "admin";
        List<Menu> menus = this.baseMapper.getAllMenuTree(username);
        return MenuTreeBuilderUtil.build(menus);
    }
}
